<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <!-- import CSS -->
    <!-- <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">-->
    <link rel="stylesheet" href="/css/elindex.css">
    <!-- import Vue before Element -->
    <script src="/js/vue.js"></script>
    <!-- import JavaScript -->
    <!--<script src="https://unpkg.com/element-ui/lib/index.js"></script>-->
    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <script type="text/javascript" src="/js/index.js"></script>
    <script type="text/javascript" src="/js/axios.js"></script>
    <!--<script src="/js/p5.min.js"></script>
    <script src="/js/index1.js"></script>
    <link rel="stylesheet" href="/css/style.css">-->
    <!--导航栏下-->
    <!-- bootstrap的css核心，定义了很多class -->
    <link rel="stylesheet" type="text/css" href="/css/bootstrap.css"/>
    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <!--生成弹框、提示框、下拉菜单  -->
    <script type="text/javascript" src="/bootstrap/popper.min.js"></script>
    <!--bootstrap的js、用于响应事件  -->
    <script type="text/javascript" src="/bootstrap/bootstrap.min.js"></script>
    <link href="/css/style.css" rel="stylesheet" type="text/css" media="all"/>

    <!--导航栏上-->
</head>
<body>
<!--导航栏内容上-->
<<div id="navigationBar">
    <div class="header-bottom">
        <div class="container">
            <nav class="navbar navbar-default">
                <!-- Brand and toggle get grouped for better mobile display -->
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed"
                            data-toggle="collapse"
                            data-target="#bs-example-navbar-collapse-1">
                        <span class="sr-only">Toggle navigation</span> <span
                            class="icon-bar"></span> <span class="icon-bar"></span> <span
                            class="icon-bar"></span>
                    </button>
                    <div class="logo">
                        <h1>
                            <a class="navbar-brand" href="/index.html">yoga</a>
                        </h1>
                    </div>
                </div>
                <!-- Collect the nav links, forms, and other content for toggling -->
                <div class="collapse navbar-collapse nav-wil"
                     id="bs-example-navbar-collapse-1">
                    <nav class="cl-effect-1" id="cl-effect-1">
                        <ul class="nav navbar-nav">
                            <!--<li><a href="#home" class="active" data-hover="Home">首页</a></li>
                            <li><a href="#about" class="scroll" data-hover="About">关于</a></li>-->
                            <!--<li><a href="#services" class="scroll" data-hover="Services">私教课程</a></li>-->
                            <li><a href="#student" class="scroll" data-hover="student">学员风采</a></li>
                            <li v-if="roles != 0"><a href="/ClubMap.html"
                                                     class="scroll" data-hover="Team">场馆地图</a></li>
                            <li v-if="roles != 0"><a href="/CoachMap.html"
                                                     class="scroll" data-hover="Team">教练地图</a></li>
                            <li v-if="roles == 1||roles == 2"><a href="/student/showMe"
                                                                 class="scroll" data-hover="Team">学员信息完善</a></li>
                            <li v-if="roles == 1||roles == 3"><a href="/coach/showMe"
                                                                 class="scroll" data-hover="Team">教练信息完善</a></li>
                            <li v-if="roles == 1||roles == 4"><a
                                    href="/yogaclub/showMe" class="scroll" data-hover="Team">场馆信息完善</a></li>
                            <li><a href="#gallery" class="scroll" data-hover="Projects">会馆图片</a></li>
                            <li v-if="roles == -1"><a href="/login.html" class="scroll"
                                                      data-hover="login">登陆</a></li>
                            <li v-if="roles == -1"><a href="/register.html"
                                                      class="scroll" data-hover="register">注册</a></li>
                            <li v-if="roles == 5"><a href="/adminindex.html"
                                                     class="scroll" data-hover="register">管理</a></li>
                            <li
                                    v-if="roles == 1||roles == 2||roles == 3||roles == 4||roles ==5"><a
                                    href="/logout">注销</a></li>
                            <li>
                                <button class="btn btn-default " type="button"
                                        id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true"
                                        aria-expanded="true"
                                        style="opacity: 0.5; background-color: #4CAF50;"
                                        v-if="roles == 4">
                                    我 <span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu" style="opacity: 0.5"
                                    v-if="roles == 4">
                                    <li><a href="#">我的主页</a></li>
                                    <li><a href="/html/chat.html">信息中心</a></li>
                                </ul>
                                <button class="btn btn-default dropdown-toggle" type="button"
                                        id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true"
                                        aria-expanded="true" style="opacity: 0.5;" v-if="roles == 3">
                                    我 <span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu" aria-labelledby="dropdownMenu2"
                                    style="opacity: 0.5" v-if="roles == 3">
                                    <li><a href="/orderShowCoach.html">我的订单</a></li>
                                    <li><a href="/coachmes.html">我的详情</a></li>
                                    <li><a href="/pocket.html">我的钱包</a></li>
                                    <li><a href="/html/chat.html">信息中心</a></li>
                                </ul>
                                <button class="btn btn-default dropdown-toggle" type="button"
                                        id="dropdownMenu3" data-toggle="dropdown" aria-haspopup="true"
                                        aria-expanded="true" style="opacity: 0.5;" v-if="roles == 2">
                                    我 <span class="caret"></span>
                                </button>

                                <ul class="dropdown-menu" aria-labelledby="dropdownMenu3"
                                    style="opacity: 0.5" v-if="roles == 2">
                                    <li><a href="/orderShowStudent.html">我的订单</a></li>
                                    <li><a href="/pocket.html">我的钱包</a></li>
                                    <li><a href="/html/chat.html">信息中心</a></li>
                                </ul>
                            </li>
                        </ul>
                    </nav>
                </div>


                <div class="collapse navbar-collapse nav-wil">
                    <div class="cl-effect-1" id="cl-effect-2"></div>
                </div>
                <!-- /.navbar-collapse -->
            </nav>
        </div>
    </div>
</div>

<div class="table_c">
<div id="app" >
    <br>
    <div id="top" align="center" style="opacity: 0.96">

            <el-button size="large" type="success" round class="el-icon-s-home" @click="all">所有</el-button>
        &nbsp;&nbsp;
        <el-badge :value="count4" class="item">
            <el-button size="large" type="success" round  class="el-icon-s-order" @click="isappraise">待支付</el-button>
        </el-badge>
        &nbsp;&nbsp;&nbsp;&nbsp;
        <el-badge :value="count6" class="item">
            <el-button size="large" type="primary"  round class="el-icon-chat-dot-round" @click="ispay">&nbsp;待评论</el-button>
        </el-badge>
    </div>

    <el-table :data="tableData"  style="padding: 25px; opacity: 0.7;
    background-color: rgba(255,255,255,0.5); "
    >


        <el-table-column type="expand"
    >

            <template slot-scope="scope">
                <el-form label-position="left" inline class="demo-table-expand">

                    <el-table :data="scope.row.detailOrders" style="width: 100%" height="170" >

                        <el-table-column prop="transctionid" label="交易号" width="300">
                        </el-table-column>
                        <el-table-column prop="otime" label="下单时间" width="370">
                        </el-table-column>
                        <el-table-column prop="paytime" label="支付时间" width="370">
                        </el-table-column>
                        <el-table-column label="当前状态" width="300">
                            <template slot-scope="scope1">
                                <i v-if="scope1.row.state===1">已请求</i>
                                <i v-if="scope1.row.state===2">已拒绝</i>
                                <i v-if="scope1.row.state===3">未上课</i>
                                <i v-if="scope1.row.state===4"><!--@click="add(scope1.row.detailoid,scope.row.sid,scope.row.cid,scope.row.oid,scope.row.money)">-->
                                    <el-button type="success"
                                               @click="dialogVisiblePass = true">
                                        未支付
                                    </el-button>
                                    <el-dialog title="请输入密码" :visible.sync="dialogVisiblePass" >
                                        <el-input v-model="pass"  show-password></el-input>
                                        <br><br>

                                        <br>
                                        <span slot="footer" class="dialog-footer">
					<el-button @click="dialogVisiblePass = false">取 消</el-button>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<el-button type="primary"
                               @click="checkpass(scope1.row.detailoid,scope.row.sid,scope.row.cid,scope.row.oid,scope.row.money)">确 定</el-button>
				        </span>

                                    </el-dialog>
                                </i>
                                <i v-if="scope1.row.state===5">已支付</i>
                                <i v-if="scope1.row.state===6">
                                    <el-button type="success" @click="dialogVisible = true"> 未评论</el-button>
                                    <el-dialog title="评论" :visible.sync="dialogVisible" center>
                                        <el-input v-model="appraise" @click="add"></el-input>
                                        <br><br>
                                        <el-rate v-model="value" show-score text-color="#ff9900"
                                                 score-template="{value}">
                                        </el-rate>
                                        <br>
                                        <span slot="footer" class="dialog-footer">
					<el-button @click="dialogVisible = false">取 消</el-button>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<el-button type="primary"
                               @click="add1(scope1.row.detailoid,scope.row.sid,scope.row.cid,scope.row.oid)">确 定</el-button>
				        </span>

                                    </el-dialog>
                                </i>
                                <i v-if="scope1.row.state===7">
                                    <el-button type="success" @click="dialogVisible = true,appraise=scope1.row.appraises[0].mes,value=scope1.row.appraises[0].state"> 修改评论</el-button>
                                    <el-dialog title="评论" :visible.sync="dialogVisible" center>
                                        <el-input v-model="appraise" ></el-input>
                                        <br><br>
                                        <el-rate v-model="value" show-score text-color="#ff9900"
                                                 score-template="{value}">
                                        </el-rate>
                                        <br>
                                        <span slot="footer" class="dialog-footer">
					<el-button @click="dialogVisible = false">取 消</el-button>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<el-button type="primary"
                               @click="add2(scope1.row.detailoid,scope.row.sid,scope.row.cid,scope.row.oid,scope1.row.appraises[0].apid)">确 定</el-button>
				        </span>

                                    </el-dialog>
                                </i>
                            </template>

                        </el-table-column>

                        <!--  -->
                    </el-table>
                </el-form>
            </template>
        </el-table-column >
        <el-table-column label="教练" prop="cname">
        </el-table-column>
        <el-table-column label="课程" prop="course">
        </el-table-column>
        <el-table-column label="时间段" prop="coursetime">
        </el-table-column>
        <el-table-column label="金额" prop="money">
        </el-table-column>
        <el-table-column label="课时" prop="courseperiod">
        </el-table-column>


    </el-table>
</div>
</div>
</div>
</body>

<script>

    window.onload = function () {
        var a = new Vue({
            el: '#app',
            data: {
                tableData: [1],
                dialogVisible: false,
                value: 5,
                appraise: '哈哈',
                count4:0,
                count6:0,
                dialogVisiblePass:false,
                pass:'',
                id:0
            },
            methods: {
                add: function (detailoid, sid, cid, oid, money) {

                    $.ajax({
                        type: "post",
                        data: {
                            detailoid:detailoid,
                            sid:sid,
                            cid:cid,
                            oid:oid,
                            money:money


                        },
                        url: "student/payorder",

                        success: function (response) {

                        if(response.indexOf("金额")!=-1){

                            alert(response)
                        }

                        else{
                            alert(response)
                            location.reload();

                        }
                    }
                    });
                    /*axios.post('/student/payorder',
                        "detailoid=" + detailoid +
                        "&sid=" + sid +
                        "&cid=" + cid +
                        "&oid=" + oid +
                        "&money=" + money
                    )
                        .then(function (response) {

                            alert(response.$data);
                            location.reload();


                            console.log(response);

                        })
                        .catch(function (error) {
                            console.log(error);
                        });*/
                },
                add1: function (detailoid, sid, cid, oid) {
                    //发送数据
                    axios.post('/student/evaluate',
                        "detailoid=" + detailoid +
                        "&sid=" + sid +
                        "&cid=" + cid +
                        "&oid=" + oid +
                        "&state=" + this.value +
                        "&mes=" + this.appraise
                    )
                        .then(function (response) {


                            console.log(response);

                        })
                        .catch(function (error) {
                            console.log(error);
                        });

                    this.dialogVisible = false;
                    this.$message({
                        message: '评论成功',
                        type: 'success',

                    });




                },
                add2: function (detailoid, sid, cid, oid,apid) {
                    //发送数据
                    axios.post('/student/fixevaluate',
                        "detailoid=" + detailoid +
                        "&sid=" + sid +
                        "&cid=" + cid +
                        "&oid=" + oid +
                        "&state=" + this.value +
                        "&mes=" + this.appraise+
                         "&apid=" +apid
                    )
                        .then(function (response) {


                            console.log(response);

                        })
                        .catch(function (error) {
                            console.log(error);
                        });

                    this.$message({
                        message: '修改评论成功',
                        type: 'success',

                    });

                    this.dialogVisible = false;


                },
                ispay:function(){
                    $.ajax({
                        type: "post",
                        data: {
                            uid: a.$data.id


                        },
                        url: "/ordershow/showispayorder",

                        success: function (response) {


                            a.$data.tableData = response;

                        }
                    });
                },
                isappraise:function(){
                $.ajax({
                type: "post",
                data: {
                    uid: a.$data.id


                },
                url: "/ordershow/showisappraiseorder",

                success: function (response) {


                    a.$data.tableData = response;

                }
            });
        },
                all:function () {

                    $.ajax({
                        type: "post",
                        data: {
                            uid: a.$data.id

                        },
                        url: "/ordershow/showorder",

                        success: function (response) {


                            a.$data.tableData = response;

                        }
                    });
                },
                checkpass:function (detailoid, sid, cid, oid, money) {
                   
                    $.ajax({
                        type: "post",
                        data: {
                            pass: a.$data.pass,


                        },
                        url: "/pocket/verifyPass",

                        success: function (response) {


                            alert(response);
                            if(response.indexOf("成功")!=-1){
                                a.add(detailoid, sid, cid, oid, money)
                            }


                        }
                    });
                }




            }

        });
        $.ajax({
            type: "get",

            url: "/re/req",
            data:"json",

            success: function (response) {

               a.$data.id=response;
                a.all();
                $.ajax({
                    type: "post",
                    data: {
                        uid: a.$data.id

                    },
                    url: "/ordershow/count",

                    success: function (response) {


                        a.$data.count4 = response.count4;
                        a.$data.count6 = response.count6;

                    }
                });
            }
        });
        new Vue({
            el: "#navigationBar",
            data: {roles: ""},
            beforeCreate: function () {
                var temp = this;
                axios.get("/user/getRoles").then(function (value) {
                    temp.roles = value.data
                });
            }
        })

    };


</script>
<style >
    body {
        margin: 0px;
        padding: 0px;
        background-image: url('/3.jpg');
        background-repeat: no-repeat;
        background-size: 100% 100%;
        background-attachment: fixed;
        height: 100%;
    }



</style>
</html>
